/**
 * @description router全局配置，如有必要可分文件抽离，其中asyncRoutes只有在intelligence模式下才会用到，pro版只支持remixIcon图标，具体配置请查看vip群文档
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/vab/layouts'
import {
  publicPath,
  routerMode
} from '@/config'

Vue.use(VueRouter)
export const constantRoutes = [{
    path: '/login',
    component: () => import('@/views/login'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/register',
    component: () => import('@/views/register'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/callback',
    component: () => import('@/views/callback'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/403',
    name: '403',
    component: () => import('@/views/Error403'),
    meta: {
      hidden: true,
    },
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/Error404'),
    meta: {
      hidden: true,
    },
  },
]

export const asyncRoutes = [{
    path: '/',
    name: 'Root',
    component: Layout,
    meta: {
      title: '首页',
      icon: 'home-2-line',
      breadcrumbHidden: true,
    },
    children: [
      {
        path: 'index',
        name: 'Index',
        component: () => import('@/views/index/dashboard'),
        meta: {
          title: '首页',
          noClosable: true,
          icon: 'home-2-line',
        },
      },
      {
        path: 'workbench',
        name: 'Workbench',
        component: () => import('@/views/index/workbench'),
        meta: {
          title: '工作台',
          icon: 'settings-6-line',
          dot: true,
        },
      },
    ],
  },
  {
    path: '/goods',
    name: 'Goods',
    component: Layout,
    meta: {
      title: '商品',
      icon: 'handbag-line',
    },
    children: [{
        path: 'goodslist',
        name: 'goodslist',
        component: () => import('@/views/goods/goodsList'),
        meta: {
          title: '商品档案',
          icon: 'book-3-line',
          // tabHidden: true,
        },
      },
      {
        path: 'goodscreate',
        name: 'goodscreate',
        component: () => import('@/views/goods/goodscreate'),
        meta: {
          hidden: true,
          title: '商品信息',
          activeMenu: '/goods/goodscreate',
          dynamicNewTab: true, //详情页根据id传参不同可打开多个
        },
      },
      {
        path: 'goodsEdit',
        name: 'goodsEdit',
        component: () => import('@/views/goods/goodsEdit'),
        meta: {
          hidden: true,
          title: '商品编辑',
          activeMenu: '/goods/goodsEdit',
          dynamicNewTab: true, //详情页根据id传参不同可打开多个
        },
      },
	  {
	    path: 'goodsLook',
	    name: 'goodsLook',
	    component: () => import('@/views/goods/goodsLook'),
	    meta: {
	      hidden: true,
	      title: '商品查看',
	      activeMenu: '/goods/goodsLook',
	      dynamicNewTab: true, //详情页根据id传参不同可打开多个
	    },
	  },
      {
        path: 'Category',
        name: 'Category',
        component: () => import('@/views/goods/goodsCategory'),
        meta: {
          title: '商品分类',
          icon: 'error-warning-line',
          // tabHidden: true,
        },
      },
      {
        path: 'profile',
        name: 'profile',
        component: () => import('@/views/goods/profile'),
        meta: {
          title: '辅助资料',
          icon: 'error-warning-line',
          // tabHidden: true,
        },
      },
      // {
      //   path: 'goodsPermissions',
      //   name: 'goodsPermissions',
      //   component: () => import('@/views/goods/goodsPermissions'),
      //   meta: {
      //     title: '商品权限配置',
      //     icon: 'error-warning-line',
      //     // tabHidden: true,
      //   },
      // },
      {
        path: 'goodsImg',
        name: 'goodsImg',
        component: () => import('@/views/goods/goodsImg'),
        meta: {
          title: '商品图片',
          icon: 'error-warning-line',
          // tabHidden: true,
        },
      },
    ],
  },
  {
    path: '/order',
    name: 'Order',
    component: Layout,
    meta: {
      title: '订单',
      icon: 'article-line',
    },
    children: [{
        path: 'orderlist',
        name: 'orderlist',
        component: () => import('@/views/order/orderlist'),
        meta: {
          title: '订单列表',
          icon: 'book-3-line',
          // tabHidden: true,
        },
      },
      {
        path: 'addneworder',
        name: 'addneworder',
        component: () => import('@/views/order/addneworder'),
        meta: {
          hidden: true,
          title: '新增订单',
          activeMenu: '/order/addneworder',
          dynamicNewTab: true, //详情页根据id传参不同可打开多个
        },
      },
      {
        path: 'editor',
        name: 'editor',
        component: () => import('@/views/order/editor'),
        meta: {
          hidden: true,
          title: '订单编辑',
          activeMenu: '/order/editor',
          dynamicNewTab: true, //详情页根据id传参不同可打开多个
        },
      },
      {
        path: 'orderDetail',
        name: 'orderDetail',
        component: () => import('@/views/order/orderDetail'),
        meta: {
          hidden: true,
          title: '订单详情',
          activeMenu: '/order/orderDetail',
          dynamicNewTab: true, //详情页根据id传参不同可打开多个
        },
      },
      {
        path: 'addsceneorder',
        name: 'addsceneorder',
        component: () => import('@/views/order/addsceneorder'),
        meta: {
          hidden: true,
          title: '新增现场采购单',
          activeMenu: '/order/addsceneorder',
          dynamicNewTab: true, //详情页根据id传参不同可打开多个
        },
      },
      // {
      //   path: 'ordergoods',
      //   name: 'ordergoods',
      //   component: () => import('@/views/order/ordergoods'),
      //   meta: {
      //     title: '订单商品',
      //     icon: 'book-3-line',
      //     // tabHidden: true,
      //   },
      // },
      {
        path: 'ordertotal',
        name: 'ordertotal',
        component: () => import('@/views/order/ordertotal'),
        meta: {
          title: '订单汇总',
          icon: 'book-3-line',
          // tabHidden: true,
        },
      },
      // {
      //   path: 'orderchangeprice',
      //   name: 'orderchangeprice',
      //   component: () => import('@/views/order/orderchangeprice'),
      //   meta: {
      //     title: '批量核价',
      //     icon: 'book-3-line',
      //     tabHidden: true,
      //   },
      // },
      {
        path: 'ordereturn',
        name: 'ordereturn',
        component: () => import('@/views/order/ordereturn'),
        meta: {
          title: '退货退款',
          icon: 'book-3-line',
          // tabHidden: true,
        },
      },
      // {
      //   path: 'ordermodify',
      //   name: 'ordermodify',
      //   component: () => import('@/views/order/ordermodify'),
      //   meta: {
      //     title: '实收变更',
      //     icon: 'book-3-line',
      //     tabHidden: true,
      //   },
      // },
      // {
      //   path: 'orderabnormal',
      //   name: 'orderabnormal',
      //   component: () => import('@/views/order/orderabnormal'),
      //   meta: {
      //     title: '异常订单',
      //     icon: 'book-3-line',
      //     // tabHidden: true,
      //   },
      // },
      {
        path: 'ordertag',
        name: 'ordertag',
        component: () => import('@/views/order/ordertag'),
        meta: {
          title: '订单标签',
          icon: 'book-3-line',
          // tabHidden: true,
        },
      },
      // {
      //   path: 'smartprice',
      //   name: 'smartprice',
      //   component: () => import('@/views/order/smartprice'),
      //   meta: {
      //     title: '智能定价',
      //     icon: 'book-3-line',
      //     // tabHidden: true,
      //   },
      // },
    ],
  },
  {
    path: '/purchase',
    name: 'Purchase',
    component: Layout,
    meta: {
      title: '采购',
      icon: 'shopping-cart-2-line',
    },
    children: [{
        path: 'purchasenote',
        name: 'Purchasenote',
        component: () => import('@/views/purchase/purchasenote/purchasenote'),
        meta: {

          title: '采购单',
          // dynamicNewTab:true,
          icon: 'shopping-cart-2-line',
          // tabHidden: true,
        },
      },
      // take delivery of goods
      {
        //采购单中的收货
        path: 'purchasenote_putgoods/:id',
        name: 'purchasenote_putgoods',
        component: () => import('@/views/purchase/purchasenote/components/purchasenote_putgoods.vue'),
        meta: {

          title: '收货',
          hidden: true,
          // dynamicNewTab:true,
          // icon: 'error-warning-line',
          // tabHidden: true,
        },
      },
      {
        path: 'purchasenoteAdd',
        name: 'purchasenoteAdd',
        component: () => import('@/views/purchase/purchasenote/add'),
        meta: {
          activeMenu: '/purchase/purchasenoteAdd',
          title: '新增',
          hidden: true,
          dynamicNewTab: true
        },
      },
      {
        path: 'purchasenoteEdit/:id',
        name: 'purchasenoteEdit',
        component: () => import('@/views/purchase/purchasenote/add'),
        meta: {
          activeMenu: '/purchase/purchasenoteAdd',
          title: '编辑',
          hidden: true,
          dynamicNewTab: true
        },
      }, {
        path: 'purchasenotedetails/:id',
        name: 'purchasenotedetails',
        component: () => import('@/views/purchase/purchasenote/purchasenotedetails'),
        meta: {
          activeMenu: '/purchase/purchasenoteAdd',
          title: '详情',
          hidden: true,
          dynamicNewTab: true
        },
      },
      // {
      //   path: 'intelligentforecastmining',
      //   name: 'Intelligentforecastmining',
      //   component: () =>
      //     import(
      //       '@/views/purchase/intelligentforecastmining/intelligentforecastmining'
      //     ),
      //   meta: {
      //     title: '智能预采',
      //     // icon: 'error-warning-line',
      //     // tabHidden: true,
      //   },
      // },
      {
        path: 'purchasingback',
        name: 'Purchasingback',
        component: () =>
          import('@/views/purchase/purchasingback/purchasingback.vue'),
        meta: {
          title: '采购退回',
          hidden: false,
          icon: 'ship-line',
          // tabHidden: true,
        }
      }, {
        path: 'addpurchasingback',
        name: 'addPurchasingback',
        component: () =>
          import('@/views/purchase/purchasingback/add.vue'),
        meta: {
          title: '新增',
          hidden: true
          // icon: 'error-warning-line',
          // tabHidden: true,
        }
      },{
        path: 'editpurchasingback/:id',
        name: 'editpurchasingback',
        component: () =>
          import('@/views/purchase/purchasingback/edit.vue'),
        meta: {
          title: '编辑',
          hidden: true
          // icon: 'error-warning-line',
          // tabHidden: true,
        }
      },
      {
        path: 'purchasehistory',
        name: 'Purchasehistory',
        component: () =>
          import('@/views/purchase/purchasehistory/purchasehistory'),
        meta: {
          title: '采购历史',
          hidden: true
          // icon: 'error-warning-line',
          // tabHidden: true,
        },
      },
      {
        path: 'initialvalue',
        name: 'Initialvalue',
        meta: {
          title: '基础资料',
          icon: 'user-settings-line',
          // tabHidden: true,
        },
        children: [{
            path: 'supplier',
            name: 'Supplier',
            component: () =>
              import('@/views/purchase/initialvalue/supplier/supplier'),
            meta: {
              title: '供应商',
              icon: 'shopping-bag-3-line',
              // tabHidden: true,
            },
          }, {
            path: 'supplieradd',
            name: 'Supplieradd',
            component: () =>
              import('@/views/purchase/initialvalue/supplier/basicinformation/add.vue'),
            meta: {
              title: '新增',
              hidden: true,
            },
          },
          {
            path: 'supplierbasicedit/:id',
            name: 'supplierbasicedit',
            component: () =>
              import('@/views/purchase/initialvalue/supplier/basicinformation/supplierbasicedit'),
            meta: {
              title: '编辑',
              hidden: true,
            },
          },
          {
            path: 'binduser/:id',
            name: 'binduser', //绑定用户
            component: () =>
              import('@/views/purchase/initialvalue/supplier/basicinformation/binduser'),
            meta: {
              title: '绑定用户',
              hidden: true,
            },
          },
          {
            path: 'supplierbasicdetails/:id',
            name: 'supplierbasicdetails',
            component: () =>
              import('@/views/purchase/initialvalue/supplier/basicinformation/supplierbasicdetails'),
            meta: {
              title: '详情',
              hidden: true,
            },
          },
          {
            path: 'supplierprocuremadd',
            name: 'Supplierprocuremadd',
            component: () =>
              import('@/views/purchase/initialvalue/supplier/procurementprice/add.vue'),
            meta: {
              title: '新增',
              hidden: true,
              // icon: 'error-warning-line',
              // tabHidden: true,
            },
          },
          {
            path: 'supplier/binduser/:id',
            name: 'binduserforsupplier', //绑定用户
            component: () =>
              import('@/views/purchase/initialvalue/supplier/basicinformation/binduser'),
            meta: {
              title: '绑定用户',
              hidden: true,
            },
          },
          {
            path: 'buyer',
            name: 'Buyer',
            component: () =>
              import('@/views/purchase/initialvalue/buyer/buyer'),
            meta: {
              title: '采购员',
              icon: 'shopping-cart-2-line',
              tabHidden: true,
            },
          },
          {
            path: 'purchaser/binduser/:id',
            name: 'binduserforpurchaser', //绑定用户
            component: () =>
              import('@/views/purchase/initialvalue/buyer/binduser'),
            meta: {
              title: '绑定用户',
              hidden: true,
            },
          }, {
            path: 'buyerdetails/:id',
            name: 'Buyerdetails',
            component: () =>
              import('@/views/purchase/initialvalue/buyer/buyerdetails'),
            meta: {
              title: '详情',
              hidden: true,
              // icon: 'error-warning-line',
              // tabHidden: true,
            },
          }, {
            path: 'buyeredit/:id',
            name: 'Buyeredit',
            component: () =>
              import('@/views/purchase/initialvalue/buyer/buyeredit'),
            meta: {
              title: '编辑',
              hidden: true,
              // icon: 'error-warning-line',
              // tabHidden: true,
            },
          },
          {
            path: 'buyeradd',
            name: 'buyeradd',
            component: () =>
              import('@/views/purchase/initialvalue/buyer/add'),
            meta: {
              title: '新增',
              hidden: true,
              // icon: 'error-warning-line',
              // tabHidden: true,
            },
          }
        ],
      },
      // {
      //   path: 'enquiry',
      //   name: 'Enquiry',
      //   meta: {
      //     title: '询价',
      //     // icon: 'error-warning-line',
      //     // tabHidden: true,
      //   },
      //   children: [{
      //     path: 'inquiryrecords',
      //     name: 'Inquiryrecords',
      //     component: () =>
      //       import('@/views/purchase/enquiry/inquiryrecords/inquiryrecords'),
      //     meta: {
      //       title: '询价记录',
      //       // icon: 'error-warning-line',
      //       // tabHidden: true,
      //     },
      //   },],
      // },
    ],
  },
  {
    path: '/roomstore',
    name: 'Roomstore',
    component: Layout,
    meta: {
      title: '库房',
      icon: 'home-smile-2-line',
    },
    children: [

      {
        path: 'enterManage',
        name: 'enterManage',
        component: () => import('@/views/roomstore/enterManage'),
        meta: {
          title: '入库管理',
          icon: 'command-fill',
          // tabHidden: true,
        },
      }, {
        // 入库管理详情
        path: 'enterManageParticulars/:id',
        name: 'enterManageParticulars',
        component: () => import('@/views/roomstore/enterManageParticulars'),
        meta: {
          title: '详情',
          hidden: true,
          // icon: 'book-3-line',
          // tabHidden: true,
        },
      },{
        // 入库管理关联单号详情
        path: 'enterManagerelevanceParticulars/:id',
        name: 'enterManagerelevanceParticulars',
        component: () => import('@/views/roomstore/enterManagerelevanceParticulars'),
        meta: {
          title: '关联单号详情',
          hidden: true,
          // icon: 'book-3-line',
          // tabHidden: true,
        },
      },
      {
        // 入库管理编辑
        path: 'enterManageedit/:id',
        name: 'enterManageedit',
        component: () => import('@/views/roomstore/addEnteroOrder'),
        meta: {
          title: '编辑',
          hidden: true,
          // icon: 'book-3-line',
          // tabHidden: true,
        },
      },
      {
        path: 'addEnteroOrder',
        name: 'addEnteroOrder',
        component: () => import('@/views/roomstore/addEnteroOrder'),
        meta: {
          hidden: true,
          title: '新增入库',
          activeMenu: '/roomstore/addEnteroOrder',
          dynamicNewTab: true, //详情页根据id传参不同可打开多个
        },
      },
      {
        path: 'deliveryManage',
        name: 'deliveryManage',
        component: () => import('@/views/roomstore/deliveryManage'),
        meta: {
          title: '出库管理',
          icon: 'truck-fill',
          // tabHidden: true,
        },
      }, {
        path: 'deliveryManageParticulars/:id',
        name: 'deliveryManageParticulars',
        component: () => import('@/views/roomstore/deliveryManageParticulars'),
        meta: {
          title: '详情',
          hidden: true,
          // icon: 'book-3-line',
          // tabHidden: true,
        },
      }, {
        path: 'deliveryManageedit/:id',
        name: 'deliveryManageedit',
        component: () => import('@/views/roomstore/addDeliveryOrder'),
        meta: {
          title: '编辑',
          hidden: true,
          // icon: 'book-3-line',
          // tabHidden: true,
        },
      },
      {
        path: 'addDeliveryOrder',
        name: 'addDeliveryOrder',
        component: () => import('@/views/roomstore/addDeliveryOrder'),
        meta: {
          hidden: true,
          title: '新增出库',
          activeMenu: '/roomstore/addDeliveryOrder',
          dynamicNewTab: true, //详情页根据id传参不同可打开多个
        },
      },
      {
        path: 'basicData',
        name: 'BasicData',
        meta: {
          title: '基础资料',
          icon: 'sticky-note-2-line',
          // tabHidden: true,
        },
        children: [
          // {
          //   path: 'sorter',
          //   name: 'sorter',
          //   component: () => import('@/views/roomstore/basicData/sorter'),
          //   meta: {
          //     title: '分拣员',
          //     // icon: 'book-3-line',
          //     // tabHidden: true,
          //   },
          // },
          {
            path: 'storeSetting',
            name: 'storeSetting',
            component: () => import('@/views/roomstore/basicData/storeSetting'),
            meta: {
              title: '仓库档案',
              icon: 'table-alt-line',
              // tabHidden: true,
            },
          },
          {
            path: 'earlyStock',
            name: 'earlyStock',
            component: () => import('@/views/roomstore/basicData/earlyStock'),
            meta: {
              title: '期初库存',
              icon: 'tape-line',
              // tabHidden: true,
            },
          },
        ],
      },
    ],
  },
  {
    path: '/distribution',
    name: 'Distribution',
    component: Layout,
    meta: {
      title: '配送',
      icon: 'shopping-bag-3-line',
    },
    children: [{
        path: 'lineList',
        name: 'lineList',
        component: () => import('@/views/distribution/lineList'),
        meta: {
          title: '线路',
          icon: 'flight-takeoff-line',
          // tabHidden: true,
        },
      },
      {
        path: 'setLine',
        name: 'setLine',
        component: () => import('@/views/distribution/setLine'),
        meta: {
          title: '物流排线',
          icon: "flight-land-fill"
          // tabHidden: true,
        },
      },
      {
        path: 'lineArea',
        name: 'lineArea',
        component: () => import('@/views/distribution/lineArea'),
        meta: {
          title: '区域',
          icon: 'ghost-smile-line',
          // tabHidden: true,
        },
      },
      {
        path: 'driver',
        name: 'driver',
        component: () => import('@/views/distribution/driver'),
        meta: {
          title: '司机',
          icon: 'bike-fill',
          // tabHidden: true,
        },
      },
      {
        path: 'deliveryMap',
        name: 'deliveryMap',
        component: () => import('@/views/distribution/deliveryMap'),
        meta: {
          title: '配送地图',
          icon: 'road-map-line',
          // tabHidden: true,
        },
      },
      {
        path: 'statisticsList',
        name: 'statisticsList',
        component: () => import('@/views/distribution/statisticsList'),
        meta: {
          title: '司机绩效',
          icon: 'compass-discover-line',
          // tabHidden: true,
        },
      },
    ],
  },
  {
    path: '/customer',
    name: 'Customer',
    component: Layout,
    meta: {
      title: '客户',
      icon: 'error-warning-line',
    },
    children: [{
        path: 'profile',
        name: 'Profile',
        component: () => import('@/views/customer/components/profile'),
        meta: {
          title: '客户档案',
          icon: 'error-warning-line',
          // tabHidden: true,
        },
      },
      {
        path: 'profileAdd',
        name: 'profileAdd',
        component: () => import('@/views/customer/components/profileAdd'),
        meta: {
          hidden: true,
          title: '客户信息',
          activeMenu: '/goods/goodscreate',
          dynamicNewTab: true, //详情页根据id传参不同可打开多个
        }
      },
      {
        path: 'profileEdit',
        name: 'profileEdit',
        component: () => import('@/views/customer/components/profileEdit'),
        meta: {
          hidden: true,
          title: '客户信息',
          activeMenu: '/goods/goodscreate',
          dynamicNewTab: true, //详情页根据id传参不同可打开多个
        }
      },
      {
        path: 'type',
        name: 'Type',
        component: () => import('@/views/customer/components/type'),
        meta: {
          title: '客户类型',
          icon: 'error-warning-line',
          // tabHidden: true,
        },
      },
      {
        path: 'groupManage',
        name: 'GroupManage',
        component: () => import('@/views/customer/components/groupManage'),
        meta: {
          title: '集团管理',
          icon: 'error-warning-line',
          // tabHidden: true,
        },
      },
      {
        path: 'customerdata',
        name: 'Customerdata',
        component: () =>
          import('@/views/customer/components/customerdata/customerData'),
        meta: {
          title: '客户数据',
          icon: 'error-warning-line',
          // tabHidden: true,
        },
        children: [{
            path: 'customerKanban',
            name: 'CustomerKanban',
            component: () =>
              import(
                '@/views/customer/components/customerdata/customerKanban/customerKanban'
              ),
            meta: {
              title: '客户看板',
              // icon: 'error-warning-line',
              // tabHidden: true,
            },
          },
          {
            path: 'ordersituation',
            name: 'Ordersituation',
            component: () =>
              import(
                '@/views/customer/components/customerdata/ordersituation/ordersituation'
              ),
            meta: {
              title: '下单情况',
              // icon: 'error-warning-line',
              // tabHidden: true,
            },
          },
          {
            path: 'orderhistory',
            name: 'Orderhistory',
            component: () =>
              import(
                '@/views/customer/components/customerdata/orderhistory/orderhistory'
              ),
            meta: {
              title: '订货历史',
              // icon: 'error-warning-line',
              // tabHidden: true,
            },
          },
          {
            path: 'customerpoints',
            name: 'Customerpoints',
            component: () =>
              import(
                '@/views/customer/components/customerdata/customerpoints/customerpoints'
              ),
            meta: {
              title: '客户积分',
              // icon: 'error-warning-line',
              // tabHidden: true,
            },
          },
        ],
      },
      {
        path: 'agreementprice',
        name: 'Agreementprice',
        component: () => import('@/views/customer/components/agreementprice/agreementprice'),
        meta: {
          title: '协议价',
          icon: 'error-warning-line',
          // tabHidden: true,
        },
      },
    ],
  },
  {
    path: '/market',
    name: 'Market',
    component: Layout,
    meta: {
      title: '营销',
      icon: 'line-chart-fill',
    },
    children: [{
        path: 'campaign',
        name: 'Campaign',
        meta: {
          title: '营销活动',
          icon: 'rest-time-line',
          // tabHidden: true,
        },
        children: [{
            path: 'couponList',
            name: 'couponList',
            component: () => import('@/views/market/couponList'),
            meta: {
              title: '优惠券',
              icon: 'red-packet-line',
              // tabHidden: true,
            },
          },
          {
            path: 'couponListAdd',
            name: 'couponListAdd',
            component: () => import('@/views/market/couponListAdd'),
            meta: {
              hidden: true,
              title: '优惠卷新增',
              icon: 'refund-fill',
              tabHidden: true,
            },
          },
          {
            path: 'couponListEdit',
            name: 'couponListEdit',
            component: () => import('@/views/market/couponListEdit'),
            meta: {
              hidden: true,
              title: '优惠卷编辑',
              // icon: 'book-3-line',
              tabHidden: true,
            },
          },
          // {
          //   path: 'productDemand',
          //   name: 'productDemand',
          //   component: () => import('@/views/market/productDemand'),
          //   meta: {
          //     title: '新品需求',
          //     // icon: 'book-3-line',
          //     // tabHidden: true,
          //   },
          // },
          // {
          //   path: 'flashSale',
          //   name: 'flashSale',
          //   component: () => import('@/views/market/flashSale'),
          //   meta: {
          //     title: '限时抢购',
          //     // icon: 'book-3-line',
          //     // tabHidden: true,
          //   },
          // },
          {
            path: 'fullDecrease',
            name: 'fullDecrease',
            component: () => import('@/views/market/fullDecrease'),
            meta: {
              title: '满减满赠',
              icon: 'refund-fill',
              // tabHidden: true,
            },
          },
          {
            path: 'fullDecreaseAdd',
            name: 'fullDecreaseAdd',
            component: () => import('@/views/market/fullDecreaseAdd'),
            meta: {
              title: '满减满赠',
              hidden: true,
              // icon: 'book-3-line',
               tabHidden: true,
            },
          },
          // {
          //   path: 'integralList',
          //   name: 'integralList',
          //   component: () => import('@/views/market/integralList'),
          //   meta: {
          //     title: '积分活动',
          //     // icon: 'book-3-line',
          //     // tabHidden: true,
          //   },
          // }
        ],
      },
      // {
      //   path: 'salesman',
      //   name: 'salesman',
      //   component: () => import('@/views/market/salesman'),
      //   meta: {
      //     title: '业务员',
      //     // icon: 'book-3-line',
      //     // tabHidden: true,
      //   },
      // },
      // {
      //   path: 'businessPerformance',
      //   name: 'businessPerformance',
      //   component: () => import('@/views/market/businessPerformance'),
      //   meta: {
      //     title: '业务绩效',
      //     // icon: 'book-3-line',
      //     // tabHidden: true,
      //   },
      // },
      // {
      //   path: 'goodsPresell',
      //   name: 'goodsPresell',
      //   component: () => import('@/views/market/goodsPresell'),
      //   meta: {
      //     title: '商品预售',
      //     // icon: 'book-3-line',
      //     // tabHidden: true,
      //   },
      // },
      // {
      //   path: 'suggestions',
      //   name: 'suggestions',
      //   component: () => import('@/views/market/suggestions'),
      //   meta: {
      //     title: '反馈建议',
      //     // icon: 'book-3-line',
      //     // tabHidden: true,
      //   }
      // },
    ],
  },
  {
    path: '/finance',
    name: 'finance',
    component: Layout,
    meta: {
      title: '财务',
      icon: 'money-cny-circle-line',
    },
    children: [{
        path: 'customer',
        name: 'Customer',
        meta: {
          title: '客户',
          icon: 'account-box-line',
          // tabHidden: true,
        },
        children: [
          // {
          //   path: 'settlementList',
          //   name: 'settlementList',
          //   component: () => import('@/views/finance/customer/settlementList'),
          //   meta: {
          //     title: '客户结算',
          //     icon: 'account-circle-fill',
          //     // tabHidden: true,
          //   },
          // },
          // {
          //   path: 'feesList',
          //   name: 'feesList',
          //   component: () => import('@/views/finance/customer/feesList'),
          //   meta: {
          //     title: '客户费用',
          //     // icon: 'book-3-line',
          //     // tabHidden: true,
          //   },
          // },
          {
            path: 'settleAccounts',
            name: 'settleAccounts',
            component: () => import('@/views/finance/customer/settleAccounts'),
            meta: {
              title: '结算单',
              icon: 'coupon-4-line',
              // tabHidden: true,
            },
          },
          // {
          //   path: 'customerBalance',
          //   name: 'customerBalance',
          //   component: () => import('@/views/finance/customer/customerBalance'),
          //   meta: {
          //     title: '客户余额',
          //     // icon: 'book-3-line',
          //     // tabHidden: true,
          //   },
          // },
          {
            path: 'batchChecking',
            name: 'batchChecking',
            component: () => import('@/views/finance/customer/batchChecking'),
            meta: {
              title: '批量对账',
              icon: 'creative-commons-line',
              // tabHidden: true,
            },
          },
          {
            path: 'receiptSum',
            name: 'receiptSum',
            component: () => import('@/views/finance/customer/receiptSum'),
            meta: {
              title: '客户账款',
              icon: 'copyright-fill',
              // tabHidden: true,
            },
          },
          {
            path: 'paymentFlow',
            name: 'paymentFlow',
            component: () => import('@/views/finance/customer/paymentFlow'),
            meta: {
              title: '支付流水',
              icon: 'database-2-line',
              // tabHidden: true,
            },
          },
        ],
      },
      {
        path: 'purchase',
        name: 'Purchase',
        meta: {
          title: '供应商',
          icon: 'e-bike-2-line',
          // tabHidden: true,
        },
        children: [{
            path: 'purchaseAuditList',
            name: 'purchaseAuditList',
            component: () => import('@/views/finance/purchase/purchaseAuditList'),
            meta: {
              title: '采购结算',
              icon: 'money-cny-circle-line',
              // tabHidden: true,
            },
          },
          {
            path: 'purchaseBatchChecking',
            name: 'purchaseBatchChecking',
            component: () => import('@/views/finance/purchase/purchaseBatchChecking'),
            meta: {
              title: '批量对账',
              icon: 'money-dollar-circle-line',
              // tabHidden: true,
            },
          },
          {
            path: 'purchaseSettlementList',
            name: 'purchaseSettlementList',
            component: () => import('@/views/finance/purchase/purchaseSettlementList'),
            meta: {
              title: '结算单',
              icon: 'pantone-line',
              // tabHidden: true,
            },
          },
          {
            path: 'paySum',
            name: 'paySum',
            component: () => import('@/views/finance/purchase/paySum'),
            meta: {
              title: '采购账款',
              icon: 'spotify-line',
              // tabHidden: true,
            }
          },
          // {
          //   path: 'procurementCosts',
          //   name: 'procurementCosts',
          //   component: () => import('@/views/finance/purchase/procurementCosts'),
          //   meta: {
          //     title: '采购费用',
          //     // icon: 'book-3-line',
          //     // tabHidden: true,
          //   },
          // }
        ],
      }
    ],
  },
  {
    path: '/vab',
    name: 'Vab',
    component: Layout,
    meta: {
      title: '组件',
      hidden: true,
      icon: 'code-box-line',
    },
    children: [{
        path: 'icon',
        name: 'Icon',
        meta: {
          title: '图标',
          icon: 'remixicon-line',
        },
        children: [{
            path: 'remixIcon',
            name: 'RemixIcon',
            component: () => import('@/views/vab/icon/remixIcon'),
            meta: {
              title: '小清新图标',
            },
          },
          {
            path: 'iconSelector',
            name: 'IconSelector',
            component: () => import('@/views/vab/icon/iconSelector'),
            meta: {
              title: '图标选择器',
            },
          },
        ],
      },
      {
        path: 'permission',
        name: 'Permission',
        component: () => import('@/views/vab/permission'),
        meta: {
          title: '角色权限',
          icon: 'user-3-line',
          badge: 'Pro',
        },
      },
      {
        path: 'table',
        name: 'Table',
        meta: {
          title: '表格',
          // 非editor角色的用户可见
          guard: {
            role: ['Editor'],
            mode: 'except',
          },
          icon: 'table-2',
        },
        children: [{
            path: 'comprehensiveTable',
            name: 'ComprehensiveTable',
            component: () => import('@/views/vab/table/comprehensiveTable'),
            meta: {
              title: '综合表格',
            },
          },
          {
            path: 'detail',
            name: 'Detail',
            component: () => import('@/views/vab/table/detail'),
            meta: {
              hidden: true,
              title: '详情页',
              activeMenu: '/vab/table/comprehensiveTable',
              dynamicNewTab: true, //详情页根据id传参不同可打开多个
            },
          },
          {
            path: 'inlineEditTable',
            name: 'InlineEditTable',
            component: () => import('@/views/vab/table/inlineEditTable'),
            meta: {
              title: '行内编辑表格',
              noKeepAlive: true,
            },
          },
          {
            path: 'customTable',
            name: 'CustomTable',
            component: () => import('@/views/vab/table/customTable'),
            meta: {
              title: '自定义表格',
            },
          },
        ],
      },
      {
        path: 'card',
        name: 'Card',
        component: () => import('@/views/vab/card'),
        meta: {
          title: '卡片',
          guard: ['Admin'],
          icon: 'inbox-line',
        },
      },
      {
        path: 'list',
        name: 'List',
        component: () => import('@/views/vab/list'),
        meta: {
          title: '列表',
          guard: ['Admin'],
          icon: 'list-check-2',
        },
      },
      {
        path: 'form',
        name: 'Form',
        meta: {
          title: '表单',
          guard: ['Admin'],
          icon: 'file-list-2-line',
        },
        children: [{
            path: 'comprehensiveForm',
            name: 'ComprehensiveForm',
            component: () => import('@/views/vab/form/comprehensiveForm'),
            meta: {
              title: '综合表单',
            },
          },
          {
            path: 'stepForm',
            name: 'StepForm',
            component: () => import('@/views/vab/form/stepForm'),
            meta: {
              title: '分步表单',
            },
          },
          {
            path: 'button',
            name: 'Button',
            component: () => import('@/views/vab/form/button'),
            meta: {
              title: '按钮',
            },
          },
          {
            path: 'link',
            name: 'Link',
            component: () => import('@/views/vab/form/link'),
            meta: {
              title: '文字链接',
            },
          },
          {
            path: 'radio',
            name: 'Radio',
            component: () => import('@/views/vab/form/radio'),
            meta: {
              title: '单选框',
            },
          },
          {
            path: 'checkbox',
            name: 'Checkbox',
            component: () => import('@/views/vab/form/checkbox'),
            meta: {
              title: '多选框',
            },
          },
          {
            path: 'input',
            name: 'Input',
            component: () => import('@/views/vab/form/input'),
            meta: {
              title: '输入框',
            },
          },
          {
            path: 'inputNumber',
            name: 'InputNumber',
            component: () => import('@/views/vab/form/inputNumber'),
            meta: {
              title: '计数器',
            },
          },
          {
            path: 'select',
            name: 'Select',
            component: () => import('@/views/vab/form/select'),
            meta: {
              title: '选择器',
            },
          },
          {
            path: 'switch',
            name: 'Switch',
            component: () => import('@/views/vab/form/switch'),
            meta: {
              title: '开关',
            },
          },
          {
            path: 'slider',
            name: 'Slider',
            component: () => import('@/views/vab/form/slider'),
            meta: {
              title: '滑块',
            },
          },
          {
            path: 'timePicker',
            name: 'TimePicker',
            component: () => import('@/views/vab/form/timePicker'),
            meta: {
              title: '时间选择器',
            },
          },
          {
            path: 'datePicker',
            name: 'DatePicker',
            component: () => import('@/views/vab/form/datePicker'),
            meta: {
              title: '日期选择器',
            },
          },
          {
            path: 'dateTimePicker',
            name: 'DateTimePicker',
            component: () => import('@/views/vab/form/dateTimePicker'),
            meta: {
              title: '日期时间选择器',
            },
          },
          {
            path: 'rate',
            name: 'Rate',
            component: () => import('@/views/vab/form/rate'),
            meta: {
              title: '评分',
            },
          },
        ],
      },
      {
        path: 'editor',
        name: 'Editor',
        meta: {
          title: '编辑器',
          guard: ['Admin'],
          icon: 'edit-2-line',
        },
        children: [{
            path: 'richTextEditor',
            name: 'RichTextEditor',
            component: () => import('@/views/vab/editor/richTextEditor'),
            meta: {
              title: '富文本编辑器',
              guard: ['Admin'],
            },
          },
          {
            path: 'markdownEditor',
            name: 'MarkdownEditor',
            component: () => import('@/views/vab/editor/markdownEditor'),
            meta: {
              title: 'Markdown编辑器',
              guard: ['Admin'],
            },
          },
        ],
      },
    ],
  },
  {
    path: '/other',
    name: 'Other',
    component: Layout,
    meta: {
      title: '其他',
      icon: 'archive-line',
      hidden: true,
      guard: ['Admin'],
    },
    children: [{
        path: 'workflow',
        name: 'Workflow',
        component: () => import('@/views/other/workflow'),
        meta: {
          title: '工作流',
          guard: ['Admin'],
          icon: 'flow-chart',
        },
      },
      {
        path: 'echarts',
        name: 'Echarts',
        component: () => import('@/views/other/echarts'),
        meta: {
          title: '图表',
          guard: ['Admin'],
          icon: 'bubble-chart-line',
        },
      },
      {
        path: 'print',
        name: 'Print',
        component: () => import('@/views/other/print'),
        meta: {
          title: '打印',
          guard: ['Admin'],
          icon: 'printer-line',
        },
      },
      {
        path: 'cropper',
        name: 'Cropper',
        component: () => import('@/views/other/cropper'),
        meta: {
          title: '头像裁剪',
          guard: ['Admin'],
          icon: 'crop-line',
        },
      },
      {
        path: 'notice',
        name: 'Notice',
        component: () => import('@/views/other/notice'),
        meta: {
          title: '通知',
          guard: ['Admin'],
          icon: 'message-2-line',
        },
      },
      {
        path: 'timeline',
        name: 'Timeline',
        component: () => import('@/views/other/timeline'),
        meta: {
          title: '时间线',
          guard: ['Admin'],
          icon: 'time-line',
        },
      },
      {
        path: 'count',
        name: 'Count',
        component: () => import('@/views/other/count'),
        meta: {
          title: '数字自增长',
          guard: ['Admin'],
          icon: 'number-9',
        },
      },
      {
        path: 'tabs',
        name: 'Tabs',
        component: () => import('@/views/other/tabs'),
        meta: {
          title: '多标签',
          guard: ['Admin'],
          icon: 'bank-card-line',
        },
      },
      {
        path: 'dynamicMeta',
        name: 'DynamicMeta',
        component: () => import('@/views/other/dynamicMeta'),
        meta: {
          title: '动态Meta',
          guard: ['Admin'],
          icon: 'notification-badge-line',
          badge: '0',
        },
      },
      {
        path: 'dynamicSegment',
        name: 'DynamicSegment',
        redirect: '/other/dynamicSegment/test1/1',
        meta: {
          title: '动态路径参数',
          guard: ['Admin'],
          icon: 'arrow-left-right-line',
        },
        children: [{
            path: 'test1/:id',
            name: 'Test1',
            component: () => import('@/views/other/dynamicSegment/test1'),
            meta: {
              hidden: true,
              title: 'Params',
              dynamicNewTab: true,
            },
          },
          {
            path: 'test1/1',
            name: 'test1/1',
            component: () => import('@/views/other/dynamicSegment/test1'),
            meta: {
              title: 'Params id=1'
            },
          },
          {
            path: 'test2',
            name: 'Test2',
            component: () => import('@/views/other/dynamicSegment/test2'),
            meta: {
              hidden: true,
              title: 'Query',
              dynamicNewTab: true,
            },
          },
          {
            path: 'test2?id=1',
            name: 'test2?id=1',
            component: () => import('@/views/other/dynamicSegment/test2'),
            meta: {
              title: 'Query id=1'
            },
          },
        ],
      },
      {
        path: 'drag',
        name: 'Drag',
        meta: {
          title: '拖拽',
          guard: ['Admin'],
          icon: 'drag-drop-line',
        },
        children: [{
            path: 'dialogDrag',
            name: 'DialogDrag',
            component: () => import('@/views/other/drag/dialogDrag'),
            meta: {
              title: '弹窗拖拽',
            },
          },
          {
            path: 'cardDrag',
            name: 'CardDrag',
            component: () => import('@/views/other/drag/cardDrag'),
            meta: {
              title: '卡片拖拽',
            },
          },
          {
            path: 'flowSheetDrag',
            name: 'FlowSheetDrag',
            component: () => import('@/views/other/drag/flowSheetDrag'),
            meta: {
              title: '流程图拖拽',
              noKeepAlive: true,
            },
          },
        ],
      },
      {
        path: 'contextmenu',
        name: 'Contextmenu',
        component: () => import('@/views/other/contextmenu'),
        meta: {
          title: '右键菜单',
          guard: ['Admin'],
          icon: 'menu-2-fill',
        },
      },
      {
        path: 'loading',
        name: 'Loading',
        component: () => import('@/views/other/loading'),
        meta: {
          title: '加载',
          guard: ['Admin'],
          icon: 'loader-line',
        },
      },
      {
        path: 'player',
        name: 'Player',
        component: () => import('@/views/other/player'),
        meta: {
          title: '视频播放器',
          guard: ['Admin'],
          icon: 'video-line',
          noKeepAlive: true,
        },
      },
      {
        path: 'upload',
        name: 'Upload',
        component: () => import('@/views/other/upload'),
        meta: {
          title: '上传',
          guard: ['Admin'],
          icon: 'chat-upload-line',
        },
      },
      {
        path: 'menu1',
        name: 'Menu1',
        meta: {
          title: '多级路由缓存',
          guard: ['Admin'],
          icon: 'route-line',
        },
        children: [{
          path: 'menu1-1',
          name: 'Menu11',
          meta: {
            title: '多级路由1-1',
          },
          children: [{
            path: 'menu1-1-1',
            name: 'Menu111',
            meta: {
              title: '多级路由1-1-1',
            },
            children: [{
              path: 'menu1-1-1-1',
              name: 'Menu1111',
              meta: {
                title: '多级路由1-1-1-1',
              },
              component: () =>
                import(
                  '@/views/other/nested/menu1/menu1-1/menu1-1-1/menu1-1-1-1'
                ),
            }, ],
          }, ],
        }, ],
      },
      {
        path: 'log',
        name: 'Log',
        component: () => import('@/views/other/errorLog'),
        meta: {
          title: '错误日志模拟',
          guard: ['Admin'],
          icon: 'error-warning-line',
        },
      },
      {
        path: 'cssfx',
        name: 'Cssfx',
        component: () => import('@/views/other/cssfx'),
        meta: {
          title: 'Css动画',
          guard: ['Admin'],
          icon: 'css3-line',
        },
      },
      {
        path: 'social',
        name: 'Social',
        component: () => import('@/views/other/social'),
        meta: {
          title: '第三方登录',
          guard: ['Admin'],
          icon: 'github-fill',
        },
      },
      // {
      //   path: 'mobilePreview',
      //   name: 'MobilePreview',
      //   component: () => import('@/views/vab/mobilePreview'),
      //   meta: {
      //     title: '手机预览',
      //     guard: ['Admin'],
      //     icon: 'smartphone-line',
      //   },
      // },
      {
        path: '//github.com/chuzhixin/vue-admin-beautiful?utm_source=gold_browser_extension',
        name: 'ExternalLink',
        meta: {
          title: '外链',
          target: '_blank',
          // 等价guard: ['Admin', 'Editor'],
          guard: {
            role: ['Admin', 'Editor'],
            mode: 'oneOf',
          },
          icon: 'external-link-line',
        },
      },
      {
        path: 'iframe',
        name: 'Iframe',
        redirect: '/other/iframe/search',
        meta: {
          title: 'Iframe',
          guard: ['Admin'],
          icon: 'window-line',
        },
        children: [{
            path: 'view',
            name: 'IframeView',
            component: () => import('@/views/other/iframe/view'),
            meta: {
              hidden: true,
              title: 'Iframe',
              icon: 'window-line',
              dynamicNewTab: true,
            },
          },
          {
            path: 'view?url=https%3A%2Fwww.baidu.com&title=%E7%99%BE%E5%BA%A6',
            name: 'baiduIframe',
            component: () => import('@/views/other/iframe/view'),
            meta: {
              title: '百度',
              icon: 'baidu-fill'
            },
          },
          {
            path: 'view?url=https%3A%2Fgitee.com%2Fchu1204505056%2Fvue-admin-beautiful&title=Gitee',
            name: 'githubIframe',
            component: () => import('@/views/other/iframe/view'),
            meta: {
              title: 'Gitee',
              icon: 'github-fill'
            },
          },
          {
            path: 'search',
            name: 'IframeSearch',
            component: () => import('@/views/other/iframe/search'),
            meta: {
              title: '自定义Iframe',
              icon: 'search-2-line',
            },
          },
        ],
      },
      {
        path: 'excel',
        name: 'Excel',
        meta: {
          title: 'Excel',
          guard: ['Admin'],
          icon: 'file-excel-2-line',
        },
        children: [{
            path: 'exportExcel',
            name: 'ExportExcel',
            component: () => import('@/views/other/excel/exportExcel'),
            meta: {
              title: '导出Excel',
            },
          },
          {
            path: 'exportSelectedExcel',
            name: 'SelectExcel',
            component: () => import('@/views/other/excel/exportSelectExcel'),
            meta: {
              title: '导出选中行Excel',
            },
          },
          {
            path: 'exportMergeHeaderExcel',
            name: 'MergeHeaderExcel',
            component: () =>
              import('@/views/other/excel/exportMergeHeaderExcel'),
            meta: {
              title: '导出合并Excel',
            },
          },
        ],
      },
    ],
  },
  {
    path: '/mall',
    name: 'Mall',
    component: Layout,
    meta: {
      title: '物料源',
      icon: 'apps-line',
      levelHidden: true,
      hidden: true,
      guard: ['Admin'],
    },
    children: [{
      path: 'goods',
      name: 'Goods',
      component: () => import('@/views/mall/goods'),
      meta: {
        title: '物料市场',
        icon: 'shopping-cart-line',
        badge: 'Hot',
      },
    }, ],
  },
  {
    path: '/setting',
    name: 'PersonnelManagement',
    component: Layout,
    meta: {
      title: '配置',
      icon: 'user-settings-line',
      guard: ['Admin'],
    },
    children: [{
        path: 'personalCenter',
        name: 'PersonalCenter',
        component: () => import('@/views/setting/personalCenter'),
        meta: {
          title: '个人中心',
          icon: 'map-pin-user-line',
        },
      },
      {
        path: 'userManagement',
        name: 'UserManagement',
        component: () => import('@/views/setting/userManagement'),
        meta: {
          title: '用户管理',
          icon: 'user-3-line',
        },
      },
      {
        path: 'roleManagement',
        name: 'RoleManagement',
        component: () => import('@/views/setting/roleManagement'),
        meta: {
          title: '角色管理',
          icon: 'admin-line',
        },
      },
      {
        path: 'departmentManagement',
        name: 'DepartmentManagement',
        component: () => import('@/views/setting/departmentManagement'),
        meta: {
          title: '部门管理',
          icon: 'group-line',
        },
      },
      {
        path: 'menuManagement',
        name: 'MenuManagement',
        component: () => import('@/views/setting/menuManagement'),
        meta: {
          title: '菜单管理',
          icon: 'menu-2-fill',
        },
      },
      {
        path: 'systemLog',
        name: 'SystemLog',
        component: () => import('@/views/setting/systemLog'),
        meta: {
          title: '系统日志',
          icon: 'file-shield-2-line',
        },
      },
    ],
  },
  {
    path: '/error',
    name: 'Error',
    component: Layout,
    meta: {
      title: '错误页',
      icon: 'error-warning-line',
      levelHidden: true,
      hidden: true,
    },
    children: [{
        path: '403',
        name: 'Error403',
        component: () => import('@/views/Error403'),
        meta: {
          title: '403',
          icon: 'error-warning-line',
          // tabHidden: true,
        },
      },
      {
        path: '404',
        name: 'Error404',
        component: () => import('@/views/Error404'),
        meta: {
          title: '404',
          icon: 'error-warning-line',
          // tabHidden: true,
        },
      },
    ],
  },
  {
    path: '*',
    redirect: '/404',
    meta: {
      hidden: true,
    },
  },
]

const router = createRouter()

function fatteningRoutes(routes) {
  return routes.flatMap((route) => {
    return route.children ? fatteningRoutes(route.children) : route
  })
}

export function resetRouter(routes = constantRoutes) {
  routes.map((route) => {
    if (route.children) {
      route.children = fatteningRoutes(route.children)
    }
  })
  router.matcher = createRouter(routes).matcher
}

function createRouter(routes = constantRoutes) {
  return new VueRouter({
    base: publicPath,
    mode: routerMode,
    scrollBehavior: () => ({
      y: 0,
    }),
    routes: routes,
  })
}

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err)
}

export default router
